package com.roc.web.action.area;

import java.util.ArrayList;
import java.util.List;

import com.roc.page.BaseSearchCondition;
import com.roc.page.WhereHQLFieldBean;
import com.roc.util.Constance;

@SuppressWarnings("serial")
public class AreaSearchCondition  extends BaseSearchCondition {

	private String name;  //区域名称
	private String code;  //机构编码
	@Override
	protected List<WhereHQLFieldBean> getWhereHQLFieldBeanList() {
		List<WhereHQLFieldBean> filedBeanList = new ArrayList<WhereHQLFieldBean>();
		
		if(Constance.isNotEmpty(name)){ 
			filedBeanList.add(new WhereHQLFieldBean("T.NAME", name.trim(), "=", false));
		}
		if(Constance.isNotEmpty(code)&&!"999".equals(code)){ 
			filedBeanList.add(new WhereHQLFieldBean("T.INS_CODE", code.trim(), "=", false));
		}
		return filedBeanList;
	}

	@Override
	protected String getRowCountHQL() {
		return "  select count(*)  FROM  tbl_area  t  where 1=1  ";
	}

	@Override
	protected String getSearchHQL() {
		return "  SELECT  t.id, t.name,(SELECT i.ins_name  FROM tbl_ins_inf  i WHERE i.INS_ID_CD=t.ins_code  AND i.ins_type='1' ) ins_name,t.status,t.crt_dt,  T.REMARK1  FROM  tbl_area  t where 1=1  ";
	}

	@Override
	protected String getOrderPartOfHQL() {
		// TODO Auto-generated method stub
		return "  ";
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}
	

}
